Import mojo

Global yim_debugLines:= New StringList()
Global yim_logLines:= New StringList()
Global yim_logMax:= 15
Global yim_debugMode:Bool = False

Function Debug(s:String)
	If yim_debugMode
		yim_debugLines.AddLast(s)
	End
End

Function LogMe(s:String)
	If yim_debugMode
		yim_logLines.AddFirst(s)
		If yim_logLines.Count > yim_logMax
			yim_logLines.RemoveLast()
		End
	End
End

Function ShowDebug()
	If yim_debugMode
		Local lineCount:= 0
		While Not yim_debugLines.IsEmpty()
			DrawText(yim_debugLines.RemoveFirst(), 5, 5+lineCount*15, 0, 0)
			lineCount+=1
		Wend
		lineCount+=1
		DrawText("LOG:", 5, 5+lineCount*15, 0, 0)
		For Local s:String = Eachin yim_logLines
			lineCount+=1
			DrawText(s, 5, 5+lineCount*15, 0, 0)
		Next
	End
End